package com.itxuhang.mvc.adapter;

import com.itxuhang.mvc.handler.HttpRequestHandler;
import com.itxuhang.mvc.model.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class HttpRequestHandlerAdapter implements HandlerAdapter {
    @Override
    public boolean supports(Object handler) {
        return handler instanceof HttpRequestHandler;
    }

    @Override
    public ModelAndView handleRequest(Object handler, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ((HttpRequestHandler)handler).handleRequest(request, response);
        return null;
    }
}
